<div class="clearfix">
	<ul class="nav pull-left form-inline">
		<li class="pull-left">
			&nbsp;&nbsp;
			<select id="field" class="form-control input-sm" style="width:auto" onchange="changeCondition()" name="field">
				<option class="word" value="name">{:L('PRODUCT_NAME')}</option>
			</select>&nbsp;&nbsp;
		</li>
		<li id="conditionContent" class="pull-left">
			<select id="condition" class="form-control input-sm" style="width:auto" name="condition" onchange="changeSearch()">	
				<option value="contains">{:L('INCLUDE')}</option>
				<option value="is">{:L('YES')}</option>
				<option value="start_with">{:L('BEGINNING_CHARACTER')}</option>
				<option value="end_with">{:L('TERMINATION_CHARACTER')}</option>
				<option value="is_empty">{:L('MANDATORY')}</option>
			</select>&nbsp;&nbsp;
		</li>
		<li id="searchContent" class="pull-left">
			<input id="search" type="text" class="input-medium form-control input-sm search-query" name="search" onkeydown="if(event.keyCode==13)d_changeCondition(0)" />&nbsp;&nbsp;
		</li>
		<li class="pull-left">
			<input type="hidden" name="m" value="product"/>
			<if condition="$Think.get.by neq null"><input type="hidden" name="by" value="{$Think.get.by}"/></if>
			<button type="submit" onclick="d_changeCondition(0)" class="btn btn-primary btn-sm" >{:L('SEARCH')}</button>
		</li>
	</ul>
</div>
<empty name="list">
	<div class="alert">{:L('THERE_IS_NO_DATA')}</div>
<else/>
<table class="table table-hover">
	<thead>
		<tr>
			<td>&nbsp;</td>
			<td colspan="5">
				<input name="submit" class="btn btn-primary btn-sm" type="submit" value="{:L('SELECT')}"/>&nbsp;&nbsp;
				<input class="btn btn-sm" type="button" onclick="javascript:$('#dialog-product').dialog('close');" value="{:L('CANCEL')}"/>
			</td>
		</tr>
	</thead>
	<tfoot id="footers">
		<tr>
			<td colspan="5">
				{$page}
			</td>
		</tr>
	</tfoot>
	<tbody id="data">
		<tr>
			<th>&nbsp;</th>
			<th>{:L('PRODUCT_NAME')}</th>
			<th>{:L('PRODUCT_CATEGORY')}</th>
		</tr>
		<volist name="list" id="vo">
			<tr>
				<td><input type="checkbox" name="product_id" class="product" value="{$vo.product_id}"/></td>
				<td>{$vo.name}</td>
				<td>{$vo.category_name}</td>
			</tr>
		</volist>
	</tbody>
</table>
<script type="text/javascript">
	$('#go_page').change(function(){
		var sel = $(this).val();
		$('#dialog-product-list').load(sel,function(){
			changeCondition();
		});
		return false;
	});
	$("#data tr").click(function(){
		$(this).find('td:first-child .product').prop('checked', true);
	});
	$(function(){
		$('#footers a').click(function(){
			var rel = $(this).attr('href'); 
			$('#dialog-product-list').load(rel);    
			return false;
		});
	}); 
	function d_changeCondition(p){
		var field = $('#field option:selected').val();
		var condition = $('#condition option:selected').val();
		var search = $('#search').val();
		var url = "{:U('product/listdialog','field=')}"+field+'&condition='+condition+'&search='+search;
		$('#dialog-product-list').load(url,function(){
			changeCondition();
		});
	}
</script>
</empty>